{
 "cells": [
  {
   "cell_type": "code",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2025-01-13T01:45:58.093472Z",
     "start_time": "2025-01-13T01:45:52.903506Z"
    }
   },
   "source": [
    "import os\n",
    "\n",
    "from sklearn.datasets import fetch_california_housing\n",
    "from sklearn.linear_model import LinearRegression, SGDRegressor, Ridge, LogisticRegression, Lasso\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.preprocessing import StandardScaler\n",
    "from sklearn.metrics import mean_squared_error, classification_report, roc_auc_score\n",
    "import joblib\n",
    "import pandas as pd\n",
    "import numpy as np"
   ],
   "outputs": [],
   "execution_count": 1
  },
  {
   "cell_type": "code",
   "source": [
    "\"\"\"\n",
    "线性回归直接预测房子价格\n",
    ":return: None\n",
    "\"\"\"\n",
    "# 获取数据\n",
    "fe_cal = fetch_california_housing(data_home='data')\n",
    "\n",
    "print(\"获取特征值\")\n",
    "print(fe_cal.data.shape)\n",
    "print('-' * 50)\n",
    "print(fe_cal.data[0])\n",
    "print(\"目标值\")\n",
    "print(fe_cal.target) #单位是10万美金\n",
    "# print(fe_cal.DESCR)\n",
    "print('-' * 50)\n",
    "print(fe_cal.feature_names) #特征列的名字"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    },
    "ExecuteTime": {
     "end_time": "2025-01-13T01:47:41.378328Z",
     "start_time": "2025-01-13T01:47:41.370468Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "获取特征值\n",
      "(20640, 8)\n",
      "--------------------------------------------------\n",
      "[   8.3252       41.            6.98412698    1.02380952  322.\n",
      "    2.55555556   37.88       -122.23      ]\n",
      "目标值\n",
      "[4.526 3.585 3.521 ... 0.923 0.847 0.894]\n",
      "--------------------------------------------------\n",
      "['MedInc', 'HouseAge', 'AveRooms', 'AveBedrms', 'Population', 'AveOccup', 'Latitude', 'Longitude']\n"
     ]
    }
   ],
   "execution_count": 3
  },
  {
   "cell_type": "markdown",
   "source": [
    "MedInc - 中位收入（Median Income）\n",
    "HouseAge - 房屋年龄（House Age）\n",
    "AveRooms - 平均房间数（Average Number of Rooms）\n",
    "AveBedrms - 平均卧室数（Average Number of Bedrooms）\n",
    "Population - 人口数量（Population）\n",
    "AveOccup - 平均居住人数（Average Occupancy）\n",
    "Latitude - 纬度（Latitude）\n",
    "Longitude - 经度（Longitude）"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "source": [
    "fe_cal.target.shape"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-01-13T02:27:07.812394Z",
     "start_time": "2025-01-13T02:27:07.808317Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(20640,)"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 7
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": ""
  },
  {
   "cell_type": "code",
   "source": [
    "# 分割数据集到训练集和测试集\n",
    "x_train, x_test, y_train, y_test = train_test_split(fe_cal.data, fe_cal.target, test_size=0.25, random_state=1)\n",
    "#\n",
    "print(x_train.shape)\n",
    "#\n",
    "# # 进行标准化处理(?) 目标值处理？\n",
    "# # 特征值和目标值是都必须进行标准化处理, 实例化两个标准化API\n",
    "std_x = StandardScaler()\n",
    "#\n",
    "x_train = std_x.fit_transform(x_train) #训练集标准化\n",
    "x_test = std_x.transform(x_test) #测试集标准化\n",
    "# print(y_train.shape)\n",
    "# 目标值进行了标准化，暂时没有对目标值进行标准化处理\n",
    "# std_y = StandardScaler()\n",
    "# #\n",
    "# # #标签进行标准化\n",
    "# # 目标值是一维的，这里需要传进去2维的\n",
    "# y_train = std_y.fit_transform(y_train.reshape(-1, 1))\n",
    "# print(y_train.shape)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-01-13T03:07:44.860588Z",
     "start_time": "2025-01-13T03:07:44.854372Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(15480, 8)\n"
     ]
    }
   ],
   "execution_count": 28
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-13T02:28:01.020407Z",
     "start_time": "2025-01-13T02:28:01.018192Z"
    }
   },
   "cell_type": "code",
   "source": [
    "temp = y_train.reshape(-1, 1) #-1代表把剩余的元素都堆到哪一维\n",
    "print(temp.shape)"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(15480, 1)\n"
     ]
    }
   ],
   "execution_count": 8
  },
  {
   "cell_type": "code",
   "source": [
    "test1=np.array([1,2,3])\n",
    "print(test1.shape)\n",
    "print(test1.reshape(-1,1))"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    },
    "ExecuteTime": {
     "end_time": "2025-01-13T02:28:32.082971Z",
     "start_time": "2025-01-13T02:28:32.079861Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(3,)\n",
      "[[1]\n",
      " [2]\n",
      " [3]]\n"
     ]
    }
   ],
   "execution_count": 11
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "# 未对目标值进行标准化处理的训练代码"
  },
  {
   "cell_type": "code",
   "source": [
    "import os\n",
    "# # estimator预测\n",
    "# # # 正规方程求解方式预测结果，正规方程进行线性回归\n",
    "lr = LinearRegression()\n",
    "# fit是耗时的\n",
    "lr.fit(x_train, y_train)\n",
    "#回归系数可以看特征与目标之间的相关性\n",
    "print('回归系数', lr.coef_)\n",
    "#\n",
    "y_predict = lr.predict(x_test)\n",
    "# 保存训练好的模型，模型中保存的是w的值，也保存了模型结构\n",
    "#保存模型放在fit之后即可\n",
    "os.unlink('./tmp/test.pkl') # 删除之前的模型文件\n",
    "joblib.dump(lr, \"./tmp/test.pkl\")\n",
    "print(\"正规方程测试集里面每个房子的预测价格：\", y_predict[0:10])\n",
    "#下面是求测试集的损失，用均方误差，公式是(y_test-y_predict)^2/n\n",
    "print(\"正规方程的均方误差：\", mean_squared_error(y_test, y_predict))"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    },
    "ExecuteTime": {
     "end_time": "2025-01-13T02:43:35.392947Z",
     "start_time": "2025-01-13T02:43:35.386531Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "回归系数 [ 0.83167028  0.12159502 -0.26758589  0.30983997 -0.00518054 -0.04040421\n",
      " -0.90736902 -0.88212727]\n",
      "正规方程测试集里面每个房子的预测价格： [2.12391852 0.93825754 2.7088455  1.70873764 2.82954754 3.50376456\n",
      " 3.0147162  1.62781292 1.74317518 2.01897806]\n",
      "正规方程的均方误差： 0.5356532845422556\n"
     ]
    }
   ],
   "execution_count": 20
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "# 对目标值进行标准化处理的训练代码"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-13T02:44:20.193908Z",
     "start_time": "2025-01-13T02:44:20.187036Z"
    }
   },
   "cell_type": "code",
   "source": [
    "lr = LinearRegression()\n",
    "# fit是耗时的\n",
    "lr.fit(x_train, y_train)\n",
    "#回归系数可以看特征与目标之间的相关性\n",
    "print('回归系数', lr.coef_)\n",
    "#\n",
    "y_predict = lr.predict(x_test)\n",
    "# 保存训练好的模型，模型中保存的是w的值，也保存了模型结构\n",
    "# 预测测试集的房子价格，通过inverse得到真正的房子价格\n",
    "y_lr_predict = std_y.inverse_transform(y_predict)\n",
    "#保存模型放在fit之后即可\n",
    "os.unlink('./tmp/test.pkl') # 删除之前的模型文件\n",
    "joblib.dump(lr, \"./tmp/test.pkl\")\n",
    "print(\"正规方程测试集里面每个房子的预测价格：\", y_lr_predict[0:10])\n",
    "print(\"正规方程的均方误差：\", mean_squared_error(y_test, y_lr_predict))"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "回归系数 [[ 0.71942632  0.10518431 -0.23147194  0.26802332 -0.00448136 -0.03495117\n",
      "  -0.7849086  -0.76307353]]\n",
      "正规方程测试集里面每个房子的预测价格： [[2.12391852]\n",
      " [0.93825754]\n",
      " [2.7088455 ]\n",
      " [1.70873764]\n",
      " [2.82954754]\n",
      " [3.50376456]\n",
      " [3.0147162 ]\n",
      " [1.62781292]\n",
      " [1.74317518]\n",
      " [2.01897806]]\n",
      "正规方程的均方误差： 0.5356532845422556\n"
     ]
    }
   ],
   "execution_count": 22
  },
  {
   "cell_type": "markdown",
   "source": [
    "# 2 加载保存的模型"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "source": [
    "#模拟上线时加载模型\n",
    "model = joblib.load(\"./tmp/test.pkl\")\n",
    "# # 因为目标值进行了标准化，一定要把预测后的值逆向转换回来\n",
    "y_predict = model.predict(x_test)\n",
    "\n",
    "#\n",
    "# print(\"保存的模型预测的结果：\", y_predict[0:10])\n",
    "# print(\"正规方程的均方误差：\", mean_squared_error(y_test, y_predict))\n",
    "print(\"保存的y标准化后的模型预测的结果：\", std_y.inverse_transform(y_predict)[0:10])\n",
    "print(\"正规方程inverse后的均方误差：\", mean_squared_error(y_test,\n",
    "                                               std_y.inverse_transform(y_predict)))"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    },
    "ExecuteTime": {
     "end_time": "2025-01-13T02:45:31.889988Z",
     "start_time": "2025-01-13T02:45:31.885907Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "保存的模型预测的结果： [[2.12391852]\n",
      " [0.93825754]\n",
      " [2.7088455 ]\n",
      " [1.70873764]\n",
      " [2.82954754]\n",
      " [3.50376456]\n",
      " [3.0147162 ]\n",
      " [1.62781292]\n",
      " [1.74317518]\n",
      " [2.01897806]]\n",
      "正规方程inverse后的均方误差： 0.5356532845422556\n"
     ]
    }
   ],
   "execution_count": 23
  },
  {
   "cell_type": "code",
   "source": [
    "y_true = [3, -0.5, 2, 7]\n",
    "y_pred = [2.5, 0.0, 2, 8]\n",
    "mean_squared_error(y_true, y_pred)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    },
    "ExecuteTime": {
     "end_time": "2025-01-13T02:46:08.085316Z",
     "start_time": "2025-01-13T02:46:08.082108Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.375"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 24
  },
  {
   "cell_type": "code",
   "source": [
    "#人工求均方误差\n",
    "(np.square(3 - 2.5) + np.square(0.5) + 1) / 4\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    },
    "ExecuteTime": {
     "end_time": "2025-01-13T02:46:25.125709Z",
     "start_time": "2025-01-13T02:46:25.122936Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.375"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 25
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-13T02:51:13.661607Z",
     "start_time": "2025-01-13T02:51:13.657998Z"
    }
   },
   "cell_type": "code",
   "source": [
    "y=3*np.square(-1/3)+2*(-1/3)+1\n",
    "y"
   ],
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.6666666666666667"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 26
  },
  {
   "cell_type": "markdown",
   "source": [
    "# 3 线性回归之梯度下降去进行房价预测"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "source": [
    "# 梯度下降去进行房价预测,数据量大要用这个\n",
    "# learning_rate的不同方式，代表学习率变化的算法不一样,比如constant,invscaling,adaptive\n",
    "# 默认可以去调 eta0 = 0.008，会改变learning_rate的初始值\n",
    "# learning_rate='optimal',alpha是正则化力度，但是会影响学习率的值，由alpha来算学习率\n",
    "# penalty代表正则化，分为l1和l2\n",
    "# eta0=0.01, penalty='l2',max_iter=1000\n",
    "sgd = SGDRegressor(eta0=0.01,penalty='l2', max_iter=1000)\n",
    "# # 训练\n",
    "sgd.fit(x_train, y_train)\n",
    "#\n",
    "print('梯度下降的回归系数', sgd.coef_)\n",
    "#\n",
    "# 预测测试集的房子价格\n",
    "# y_sgd_predict = std_y.inverse_transform(sgd.predict(x_test).reshape(-1, 1))\n",
    "y_predict = sgd.predict(x_test)\n",
    "# print(\"梯度下降测试集里面每个房子的预测价格：\", y_sgd_predict)\n",
    "print(\"梯度下降的均方误差：\", mean_squared_error(y_test, y_predict))\n",
    "# print(\"梯度下降的原始房价量纲均方误差：\", mean_squared_error(std_y.inverse_transform(y_test), y_sgd_predict))"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    },
    "ExecuteTime": {
     "end_time": "2025-01-13T03:07:55.259986Z",
     "start_time": "2025-01-13T03:07:55.243955Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "梯度下降的回归系数 [ 0.81803885  0.12633362 -0.23485282  0.35394739 -0.00291484 -0.01617019\n",
      " -0.9218979  -0.88947926]\n",
      "梯度下降的均方误差： 0.5375925120368399\n"
     ]
    }
   ],
   "execution_count": 29
  },
  {
   "cell_type": "code",
   "source": [
    "w=1\n",
    "learning_rate=0.1  #这里是学习率，可以调节\n",
    "def loss(w):\n",
    "    return 3*w**2+2*w+2\n",
    "def dao_shu(w):\n",
    "    return 6*w+2\n",
    "for i in range(30):\n",
    "    w=w-learning_rate*dao_shu(w)\n",
    "    print(f'w {w} 损失{loss(w)}')"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-01-13T03:13:44.234858Z",
     "start_time": "2025-01-13T03:13:44.232224Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "w 0.19999999999999996 损失2.5199999999999996\n",
      "w -0.12000000000000005 损失1.8032\n",
      "w -0.24800000000000003 损失1.688512\n",
      "w -0.2992 损失1.67016192\n",
      "w -0.31968 损失1.6672259072\n",
      "w -0.327872 损失1.666756145152\n",
      "w -0.33114879999999997 损失1.6666809832243201\n",
      "w -0.33245952 损失1.6666689573158913\n",
      "w -0.332983808 损失1.6666670331705427\n",
      "w -0.3331935232 损失1.6666667253072869\n",
      "w -0.33327740928 损失1.666666676049166\n",
      "w -0.333310963712 损失1.6666666681678666\n",
      "w -0.3333243854848 损失1.6666666669068586\n",
      "w -0.33332975419392 损失1.6666666667050973\n",
      "w -0.333331901677568 损失1.6666666666728156\n",
      "w -0.3333327606710272 损失1.6666666666676506\n",
      "w -0.3333331042684109 损失1.6666666666668242\n",
      "w -0.33333324170736434 损失1.6666666666666918\n",
      "w -0.33333329668294576 损失1.6666666666666707\n",
      "w -0.3333333186731783 损失1.6666666666666674\n",
      "w -0.3333333274692713 损失1.6666666666666667\n",
      "w -0.3333333309877085 损失1.6666666666666667\n",
      "w -0.3333333323950834 损失1.6666666666666665\n",
      "w -0.33333333295803336 损失1.6666666666666667\n",
      "w -0.33333333318321334 损失1.6666666666666667\n",
      "w -0.33333333327328535 损失1.6666666666666667\n",
      "w -0.33333333330931414 损失1.6666666666666667\n",
      "w -0.33333333332372567 损失1.6666666666666667\n",
      "w -0.3333333333294903 损失1.6666666666666665\n",
      "w -0.3333333333317961 损失1.6666666666666665\n"
     ]
    }
   ],
   "execution_count": 34
  },
  {
   "cell_type": "markdown",
   "source": [
    "# 4 岭回归"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "source": [
    "# # # 岭回归去进行房价预测\n",
    "#岭回归是对线性回归加入L2正则化，L2正则化是对系数的平方和进行惩罚\n",
    "#alpha就是补偿的系数\n",
    "#正规方程求解，加补偿就可以让正规方程可逆\n",
    "rd = Ridge(alpha=0.02)\n",
    "\n",
    "rd.fit(x_train, y_train)\n",
    "\n",
    "print(rd.coef_)\n",
    "#\n",
    "# # 预测测试集的房子价格\n",
    "print(rd.predict(x_test).shape)\n",
    "# y_rd_predict = std_y.inverse_transform(rd.predict(x_test))\n",
    "y_predict = rd.predict(x_test)\n",
    "# print(\"岭回归里面每个房子的预测价格：\", y_rd_predict)\n",
    "\n",
    "print(\"岭回归的均方误差：\", mean_squared_error(y_test, y_predict))\n",
    "# print(\"岭回归的均方误差：\", mean_squared_error(std_y.inverse_transform(y_test), y_rd_predict))"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    },
    "ExecuteTime": {
     "end_time": "2025-01-13T06:06:55.107403Z",
     "start_time": "2025-01-13T06:06:55.079459Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 0.83166963  0.12159681 -0.26758236  0.30983534 -0.00517992 -0.04040432\n",
      " -0.90735215 -0.88211025]\n",
      "(5160,)\n",
      "岭回归的均方误差： 0.5356531179270397\n"
     ]
    }
   ],
   "execution_count": 35
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "# 5 lasso回归"
  },
  {
   "cell_type": "code",
   "source": [
    "# # # Lasso回归去进行房价预测\n",
    "#alpha就是补偿的系数\n",
    "print(x_train.shape)\n",
    "print(y_train.shape)\n",
    "ls = Lasso(alpha=0.001)\n",
    "\n",
    "ls.fit(x_train, y_train)\n",
    "\n",
    "print(ls.coef_)\n",
    "#\n",
    "# # 预测测试集的房子价格\n",
    "print(ls.predict(x_test).shape)\n",
    "print('-'*50)\n",
    "# y_ls_predict = std_y.inverse_transform(ls.predict(x_test).reshape(-1,1))\n",
    "y_predict = ls.predict(x_test)\n",
    "# print(\"Lasso回归里面每个房子的预测价格：\", y_rd_predict)\n",
    "#\n",
    "print(\"Lasso回归的均方误差：\", mean_squared_error(y_test, y_predict))\n",
    "# print(\"Lasso回归的均方误差：\", mean_squared_error(std_y.inverse_transform(y_test), y_ls_predict))"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    },
    "ExecuteTime": {
     "end_time": "2025-01-13T06:08:03.956843Z",
     "start_time": "2025-01-13T06:08:03.718995Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(15480, 8)\n",
      "(15480,)\n",
      "[ 0.82655827  0.1225482  -0.25369194  0.29596304 -0.00381001 -0.03948424\n",
      " -0.89646842 -0.87060253]\n",
      "(5160,)\n",
      "--------------------------------------------------\n",
      "Lasso回归的均方误差： 0.5356324125105497\n"
     ]
    }
   ],
   "execution_count": 36
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-14T03:31:48.236766Z",
     "start_time": "2025-01-14T03:31:47.509676Z"
    }
   },
   "cell_type": "code",
   "source": [
    "from sklearn.linear_model import ElasticNet\n",
    "from sklearn.datasets import make_regression\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.metrics import mean_squared_error\n",
    "\n",
    "# 生成示例数据\n",
    "X, y = make_regression(n_samples=1000, n_features=20, noise=0.1, random_state=42)\n",
    "\n",
    "# 划分训练集和测试集\n",
    "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n",
    "\n",
    "# 训练 Elastic Net 模型\n",
    "model = ElasticNet(alpha=1.0, l1_ratio=0.5, random_state=42)  # alpha 是正则化强度，l1_ratio 是 alpha 参数\n",
    "model.fit(X_train, y_train)\n",
    "\n",
    "# 预测\n",
    "y_pred = model.predict(X_test)\n",
    "\n",
    "# 评估\n",
    "mse = mean_squared_error(y_test, y_pred)\n",
    "print(\"Mean Squared Error:\", mse)"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Mean Squared Error: 4638.838635649163\n"
     ]
    }
   ],
   "execution_count": 1
  },
  {
   "cell_type": "markdown",
   "source": [
    "# 5 逻辑回归"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "source": "np.log(0.8)",
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-01-13T06:40:31.367341Z",
     "start_time": "2025-01-13T06:40:31.364325Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-0.2231435513142097"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 38
  },
  {
   "cell_type": "code",
   "source": "np.log(0.1)",
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-01-13T06:40:36.430571Z",
     "start_time": "2025-01-13T06:40:36.427386Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-2.3025850929940455"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 39
  },
  {
   "cell_type": "code",
   "source": [
    "x=np.arange(0.001,1,0.01) #0-1之间，步长0.01\n",
    "import matplotlib.pyplot as plt\n",
    "plt.plot(x,-np.log(x))  #以e为底部\n",
    "plt.show()"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    },
    "ExecuteTime": {
     "end_time": "2025-01-13T06:43:13.576465Z",
     "start_time": "2025-01-13T06:43:13.536533Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ],
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAhYAAAGdCAYAAABO2DpVAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjAsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvlHJYcgAAAAlwSFlzAAAPYQAAD2EBqD+naQAAMKNJREFUeJzt3Ql4lNXd9/F/1sm+7ySEfV9UNgHRoghvXbGt5a3U4tL6qKit1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t9t/85jc6TISFhdmzsrLst956q726utqg3vuODz/8sMffv87rq27V9T75PWeddZb+b6N+rlesWOHSPnFsOgAAcBmfWGMBAAB8A8ECAAC4DMECAAC4DMECAAC4DMECAAC4DMECAAC4DMECAAC4DMECAAC4DMECAAC4DMECAAC4DMECAAC4DMECAACIq/x/Ue5Wb3A8EDQAAAAASUVORK5CYII="
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "execution_count": 41
  },
  {
   "cell_type": "code",
   "source": [
    "x=np.arange(0,1,0.01)\n",
    "import matplotlib.pyplot as plt\n",
    "plt.plot(x,-np.log(1-x))\n",
    "plt.show()"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    },
    "ExecuteTime": {
     "end_time": "2025-01-13T06:43:10.011444Z",
     "start_time": "2025-01-13T06:43:08.884448Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ],
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAhYAAAGdCAYAAABO2DpVAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjAsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvlHJYcgAAAAlwSFlzAAAPYQAAD2EBqD+naQAAL0ZJREFUeJzt3Ql4lOW5//E7+74vJCEJkEDYF1lEQLQiFXe09kirVbStnrbocTn/Vq2t1lqLVeuxx7q01tYuKlaPuCKoKCIVRJawE0jYgtlJSCaBbDPv/3qeZFICQUjyzsz7znw/1zXXLEzI42vM/HyW+w4yDMMQAAAAEwSb8ZcAAAAoBAsAAGAaggUAADANwQIAAJiGYAEAAExDsAAAAKYhWAAAANMQLAAAgGlCxctcLpeUlZVJXFycBAUFefvbAwCAPlD1NB0Oh2RlZUlwcLB1goUKFTk5Od7+tgAAwASlpaWSnZ1tnWChZircA4uPj/f2twcAAH3Q0NCgJwbcn+OWCRbu5Q8VKggWAADYy6m2MbB5EwAAmIZgAQA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1q2phsEyzOPPNMY8GCBV3PnU6nkZWVZSxcuLDH91999dXGJZdc0u21qVOnGv/5n//p8bHaXW+v9fHa29uNuLg4469//asHRxm411pd3+nTpxt/+tOfjPnz5xMsPHStn3nmGSMvL89obW314igD81qr986aNavba+qDb8aMGR4fqz+R0wgWP/nJT4zRo0d3e23evHnGnDlzTBuHLZZCWltbZf369XqK/dieI+r56tWre/wa9fqx71fmzJlz0vej79f6eEeOHJG2tjZJTk724EgD91r/8pe/lPT0dPne977npZEG5rV+6623ZNq0aXopZMCAATJmzBj59a9/LU6n04sjD4xrPX36dP017uWSPXv26CWniy++2GvjDhSrvfDZ6PUmZH1RU1Oj/2NW/3EfSz3fuXNnj19TUVHR4/vV6zD3Wh/vrrvu0ut9x//wov/XetWqVfL8889LYWGhl0YZuNdafbh99NFHcu211+oPueLiYvnRj36kQ7OqYgjzrvU111yjv+7ss8/WHTTb29vlBz/4gfz0pz/10qgDR8VJPhtVB9SjR4/qPS79ZYsZC9jHww8/rDcVLl68WG/agnlUu+LrrrtOb5ZNTU319XD8nsvl0jNDf/zjH2XSpEkyb948uffee+XZZ5/19dD8jtpMqGaDnn76admwYYO8/vrr8u6778qDDz7o66HBX2cs1C/RkJAQqays7Pa6ep6RkdHj16jXe/N+9P1auz322GM6WHz44Ycybtw4D4808K51SUmJ7Nu3T+8AP/bDTwkNDZWioiLJz8/3wsgD4+danQQJCwvTX+c2cuRI/X98aro/PDzc4+MOlGv985//XIfm73//+/q5OsXX1NQkN998sw5zaikF5jjZZ6Nqp27GbIVii39b6j9g9X8My5cv7/YLVT1Xa6A9Ua8f+37lgw8+OOn70fdrrTzyyCP6/y6WLl0qkydP9tJoA+taq6PTW7Zs0csg7tvll18u5513nn6sjujBvJ/rGTNm6OUPd3hTdu3apQMHocLca632ZR0fHtyBjnZW5vLKZ6Nho+NL6jjSCy+8oI/I3Hzzzfr4UkVFhf7z6667zrj77ru7HTcNDQ01HnvsMX0E8v777+e4qYeu9cMPP6yPlr322mtGeXl5183hcPjwn8I/r/XxOBXiuWt94MABfbrplltuMYqKiox33nnHSE9PN371q1/58J/CP6+1+v2srvXLL7+sj0O+//77Rn5+vj7dh6+mfs+qo/7qpj7SH3/8cf14//79+s/VdVbX+/jjpj/+8Y/1Z6MqFRCwx00Vdd42NzdXf4ip40xr1qzp+rNzzz1X/5I91j//+U+joKBAv18dr3n33Xd9MGp76s21HjRokP6BPv6mflnA/J/rYxEsPHutP/vsM31MXX1IqqOnDz30kD7uC3OvdVtbm/GLX/xCh4nIyEgjJyfH+NGPfmTU1dX5aPT28fHHH/f4+9d9fdW9ut7Hf82ECRP0vxv1c/2Xv/zF1DHRNh0AAJjGFnssAACAPRAsAACAaQgWAADANAQLAABgGoIFAAAwDcECAACYhmABAABMQ7AAAACmIVgAAADTECwAAIBpCBYAAMA0BAsAACBm+f/rCbw+zK0MQgAAAABJRU5ErkJggg=="
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "execution_count": 40
  },
  {
   "cell_type": "code",
   "source": [
    "\"\"\"\n",
    "逻辑回归做二分类进行癌症预测（根据细胞的属性特征）\n",
    ":return: NOne\n",
    "\"\"\"\n",
    "# 构造列标签名字\n",
    "column = ['Sample code number', 'Clump Thickness', 'Uniformity of Cell Size', 'Uniformity of Cell Shape',\n",
    "          'Marginal Adhesion', 'Single Epithelial Cell Size', 'Bare Nuclei', 'Bland Chromatin', 'Normal Nucleoli',\n",
    "          'Mitoses', 'Class']\n",
    "\n",
    "# 读取数据\n",
    "# data = pd.read_csv(\n",
    "#     \"https://archive.ics.uci.edu/ml/machine-learning-databases/breast-cancer-wisconsin/breast-cancer-wisconsin.data\",\n",
    "#     names=column)\n",
    "data = pd.read_csv(\n",
    "    \"./data/breast-cancer-wisconsin.csv\",\n",
    "    names=column)\n",
    "# print(data) #想看可以解除\n",
    "#当你读取数据时，看上去是数值的列，读进来是字符串，说明里边\n",
    "# 存在了非数值情况\n",
    "print(data.info())\n",
    "print('-'*50)\n",
    "data.describe(include='all')"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    },
    "ExecuteTime": {
     "end_time": "2025-01-13T07:27:19.152316Z",
     "start_time": "2025-01-13T07:27:19.136202Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 699 entries, 0 to 698\n",
      "Data columns (total 11 columns):\n",
      " #   Column                       Non-Null Count  Dtype \n",
      "---  ------                       --------------  ----- \n",
      " 0   Sample code number           699 non-null    int64 \n",
      " 1   Clump Thickness              699 non-null    int64 \n",
      " 2   Uniformity of Cell Size      699 non-null    int64 \n",
      " 3   Uniformity of Cell Shape     699 non-null    int64 \n",
      " 4   Marginal Adhesion            699 non-null    int64 \n",
      " 5   Single Epithelial Cell Size  699 non-null    int64 \n",
      " 6   Bare Nuclei                  699 non-null    object\n",
      " 7   Bland Chromatin              699 non-null    int64 \n",
      " 8   Normal Nucleoli              699 non-null    int64 \n",
      " 9   Mitoses                      699 non-null    int64 \n",
      " 10  Class                        699 non-null    int64 \n",
      "dtypes: int64(10), object(1)\n",
      "memory usage: 60.2+ KB\n",
      "None\n",
      "--------------------------------------------------\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "        Sample code number  Clump Thickness  Uniformity of Cell Size  \\\n",
       "count         6.990000e+02       699.000000               699.000000   \n",
       "unique                 NaN              NaN                      NaN   \n",
       "top                    NaN              NaN                      NaN   \n",
       "freq                   NaN              NaN                      NaN   \n",
       "mean          1.071704e+06         4.417740                 3.134478   \n",
       "std           6.170957e+05         2.815741                 3.051459   \n",
       "min           6.163400e+04         1.000000                 1.000000   \n",
       "25%           8.706885e+05         2.000000                 1.000000   \n",
       "50%           1.171710e+06         4.000000                 1.000000   \n",
       "75%           1.238298e+06         6.000000                 5.000000   \n",
       "max           1.345435e+07        10.000000                10.000000   \n",
       "\n",
       "        Uniformity of Cell Shape  Marginal Adhesion  \\\n",
       "count                 699.000000         699.000000   \n",
       "unique                       NaN                NaN   \n",
       "top                          NaN                NaN   \n",
       "freq                         NaN                NaN   \n",
       "mean                    3.207439           2.806867   \n",
       "std                     2.971913           2.855379   \n",
       "min                     1.000000           1.000000   \n",
       "25%                     1.000000           1.000000   \n",
       "50%                     1.000000           1.000000   \n",
       "75%                     5.000000           4.000000   \n",
       "max                    10.000000          10.000000   \n",
       "\n",
       "        Single Epithelial Cell Size Bare Nuclei  Bland Chromatin  \\\n",
       "count                    699.000000         699       699.000000   \n",
       "unique                          NaN          11              NaN   \n",
       "top                             NaN           1              NaN   \n",
       "freq                            NaN         402              NaN   \n",
       "mean                       3.216023         NaN         3.437768   \n",
       "std                        2.214300         NaN         2.438364   \n",
       "min                        1.000000         NaN         1.000000   \n",
       "25%                        2.000000         NaN         2.000000   \n",
       "50%                        2.000000         NaN         3.000000   \n",
       "75%                        4.000000         NaN         5.000000   \n",
       "max                       10.000000         NaN        10.000000   \n",
       "\n",
       "        Normal Nucleoli     Mitoses       Class  \n",
       "count        699.000000  699.000000  699.000000  \n",
       "unique              NaN         NaN         NaN  \n",
       "top                 NaN         NaN         NaN  \n",
       "freq                NaN         NaN         NaN  \n",
       "mean           2.866953    1.589413    2.689557  \n",
       "std            3.053634    1.715078    0.951273  \n",
       "min            1.000000    1.000000    2.000000  \n",
       "25%            1.000000    1.000000    2.000000  \n",
       "50%            1.000000    1.000000    2.000000  \n",
       "75%            4.000000    1.000000    4.000000  \n",
       "max           10.000000   10.000000    4.000000  "
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Sample code number</th>\n",
       "      <th>Clump Thickness</th>\n",
       "      <th>Uniformity of Cell Size</th>\n",
       "      <th>Uniformity of Cell Shape</th>\n",
       "      <th>Marginal Adhesion</th>\n",
       "      <th>Single Epithelial Cell Size</th>\n",
       "      <th>Bare Nuclei</th>\n",
       "      <th>Bland Chromatin</th>\n",
       "      <th>Normal Nucleoli</th>\n",
       "      <th>Mitoses</th>\n",
       "      <th>Class</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>6.990000e+02</td>\n",
       "      <td>699.000000</td>\n",
       "      <td>699.000000</td>\n",
       "      <td>699.000000</td>\n",
       "      <td>699.000000</td>\n",
       "      <td>699.000000</td>\n",
       "      <td>699</td>\n",
       "      <td>699.000000</td>\n",
       "      <td>699.000000</td>\n",
       "      <td>699.000000</td>\n",
       "      <td>699.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>unique</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>11</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>top</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>freq</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>402</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>1.071704e+06</td>\n",
       "      <td>4.417740</td>\n",
       "      <td>3.134478</td>\n",
       "      <td>3.207439</td>\n",
       "      <td>2.806867</td>\n",
       "      <td>3.216023</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3.437768</td>\n",
       "      <td>2.866953</td>\n",
       "      <td>1.589413</td>\n",
       "      <td>2.689557</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>6.170957e+05</td>\n",
       "      <td>2.815741</td>\n",
       "      <td>3.051459</td>\n",
       "      <td>2.971913</td>\n",
       "      <td>2.855379</td>\n",
       "      <td>2.214300</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2.438364</td>\n",
       "      <td>3.053634</td>\n",
       "      <td>1.715078</td>\n",
       "      <td>0.951273</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>6.163400e+04</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>2.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>8.706885e+05</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>2.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>1.171710e+06</td>\n",
       "      <td>4.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>2.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>1.238298e+06</td>\n",
       "      <td>6.000000</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>4.000000</td>\n",
       "      <td>4.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>4.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>4.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>1.345435e+07</td>\n",
       "      <td>10.000000</td>\n",
       "      <td>10.000000</td>\n",
       "      <td>10.000000</td>\n",
       "      <td>10.000000</td>\n",
       "      <td>10.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10.000000</td>\n",
       "      <td>10.000000</td>\n",
       "      <td>10.000000</td>\n",
       "      <td>4.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 43
  },
  {
   "cell_type": "code",
   "source": [
    "data['Bare Nuclei'].unique() #因为上面发现它是object类型"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    },
    "ExecuteTime": {
     "end_time": "2025-01-13T07:29:22.694684Z",
     "start_time": "2025-01-13T07:29:22.691050Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['1', '10', '2', '4', '3', '9', '7', '?', '5', '8', '6'],\n",
       "      dtype=object)"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 44
  },
  {
   "cell_type": "code",
   "source": [
    "# 缺失值进行处理\n",
    "data = data.replace(to_replace='?', value=np.nan)\n",
    "#直接删除，哪一行有空值，就删除对应的样本\n",
    "data = data.dropna()\n",
    "print('-' * 50)\n",
    "print(data.shape)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    },
    "ExecuteTime": {
     "end_time": "2025-01-13T07:30:04.146388Z",
     "start_time": "2025-01-13T07:30:04.141960Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "--------------------------------------------------\n",
      "(683, 11)\n"
     ]
    }
   ],
   "execution_count": 45
  },
  {
   "cell_type": "code",
   "source": [
    "data.info()"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    },
    "ExecuteTime": {
     "end_time": "2025-01-13T07:30:18.975016Z",
     "start_time": "2025-01-13T07:30:18.970558Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Index: 683 entries, 0 to 698\n",
      "Data columns (total 11 columns):\n",
      " #   Column                       Non-Null Count  Dtype \n",
      "---  ------                       --------------  ----- \n",
      " 0   Sample code number           683 non-null    int64 \n",
      " 1   Clump Thickness              683 non-null    int64 \n",
      " 2   Uniformity of Cell Size      683 non-null    int64 \n",
      " 3   Uniformity of Cell Shape     683 non-null    int64 \n",
      " 4   Marginal Adhesion            683 non-null    int64 \n",
      " 5   Single Epithelial Cell Size  683 non-null    int64 \n",
      " 6   Bare Nuclei                  683 non-null    object\n",
      " 7   Bland Chromatin              683 non-null    int64 \n",
      " 8   Normal Nucleoli              683 non-null    int64 \n",
      " 9   Mitoses                      683 non-null    int64 \n",
      " 10  Class                        683 non-null    int64 \n",
      "dtypes: int64(10), object(1)\n",
      "memory usage: 64.0+ KB\n"
     ]
    }
   ],
   "execution_count": 46
  },
  {
   "cell_type": "code",
   "source": [
    "column[10]"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    },
    "ExecuteTime": {
     "end_time": "2025-01-13T07:30:46.381675Z",
     "start_time": "2025-01-13T07:30:46.377167Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Class'"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 48
  },
  {
   "cell_type": "code",
   "source": [
    "#分类的类别是2和4,对应 \"良性\", \"恶性\"\n",
    "data[column[10]].unique()"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    },
    "ExecuteTime": {
     "end_time": "2025-01-13T07:30:38.268700Z",
     "start_time": "2025-01-13T07:30:38.265270Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([2, 4], dtype=int64)"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 47
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Index: 683 entries, 0 to 698\n",
      "Data columns (total 11 columns):\n",
      " #   Column                       Non-Null Count  Dtype \n",
      "---  ------                       --------------  ----- \n",
      " 0   Sample code number           683 non-null    int64 \n",
      " 1   Clump Thickness              683 non-null    int64 \n",
      " 2   Uniformity of Cell Size      683 non-null    int64 \n",
      " 3   Uniformity of Cell Shape     683 non-null    int64 \n",
      " 4   Marginal Adhesion            683 non-null    int64 \n",
      " 5   Single Epithelial Cell Size  683 non-null    int64 \n",
      " 6   Bare Nuclei                  683 non-null    object\n",
      " 7   Bland Chromatin              683 non-null    int64 \n",
      " 8   Normal Nucleoli              683 non-null    int64 \n",
      " 9   Mitoses                      683 non-null    int64 \n",
      " 10  Class                        683 non-null    int64 \n",
      "dtypes: int64(10), object(1)\n",
      "memory usage: 64.0+ KB\n"
     ]
    }
   ],
   "source": [
    "data.info()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-04-19T03:31:25.684610800Z",
     "start_time": "2024-04-19T03:31:25.625645200Z"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "outputs": [
    {
     "data": {
      "text/plain": "'Bare Nuclei'"
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "column[6]"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-07-15T01:59:15.570276500Z",
     "start_time": "2024-07-15T01:59:15.558242200Z"
    }
   }
  },
  {
   "cell_type": "code",
   "source": [
    "#把第6列的字符串转化为数字类型\n",
    "data[column[6]] = data[column[6]].astype('int16')"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-01-13T07:31:19.885661Z",
     "start_time": "2025-01-13T07:31:19.882951Z"
    }
   },
   "outputs": [],
   "execution_count": 49
  },
  {
   "cell_type": "code",
   "source": [
    "data.info()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-01-13T07:31:28.172905Z",
     "start_time": "2025-01-13T07:31:28.168229Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Index: 683 entries, 0 to 698\n",
      "Data columns (total 11 columns):\n",
      " #   Column                       Non-Null Count  Dtype\n",
      "---  ------                       --------------  -----\n",
      " 0   Sample code number           683 non-null    int64\n",
      " 1   Clump Thickness              683 non-null    int64\n",
      " 2   Uniformity of Cell Size      683 non-null    int64\n",
      " 3   Uniformity of Cell Shape     683 non-null    int64\n",
      " 4   Marginal Adhesion            683 non-null    int64\n",
      " 5   Single Epithelial Cell Size  683 non-null    int64\n",
      " 6   Bare Nuclei                  683 non-null    int16\n",
      " 7   Bland Chromatin              683 non-null    int64\n",
      " 8   Normal Nucleoli              683 non-null    int64\n",
      " 9   Mitoses                      683 non-null    int64\n",
      " 10  Class                        683 non-null    int64\n",
      "dtypes: int16(1), int64(10)\n",
      "memory usage: 60.0 KB\n"
     ]
    }
   ],
   "execution_count": 50
  },
  {
   "cell_type": "code",
   "source": [
    "# 进行数据的分割,第零列是编号，不可以作为特征，把第1-9列作为特征，第10列作为标签\n",
    "x_train, x_test, y_train, y_test = train_test_split(data[column[1:10]], data[column[10]], test_size=0.25,\n",
    "                                                    random_state=1)\n",
    "\n",
    "# 进行标准化处理\n",
    "std = StandardScaler()\n",
    "\n",
    "x_train = std.fit_transform(x_train) #训练集标准化\n",
    "x_test = std.transform(x_test) #测试集标准化\n",
    "x_train[0]"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    },
    "ExecuteTime": {
     "end_time": "2025-01-13T07:32:18.501785Z",
     "start_time": "2025-01-13T07:32:18.494636Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([-1.21629973, -0.70863282, -0.75174943,  0.04301674, -0.55657068,\n",
       "       -0.71054972, -0.99312055, -0.62911518, -0.36280962])"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 51
  },
  {
   "cell_type": "code",
   "source": [
    "#\n",
    "# # 逻辑回归预测\n",
    "# C正则化力度,跟学习率有关\n",
    "# solver = 'liblinear'  solver是学习率优化算法，就是学习率会随着epoch的变化而变化\n",
    "#epoch就代表第几次迭代\n",
    "#max_iter 最大迭代次数\n",
    "lg = LogisticRegression(C=0.5, solver='lbfgs')\n",
    "#\n",
    "lg.fit(x_train, y_train)\n",
    "# 逻辑回归的权重参数，了解，没那么重要\n",
    "print(lg.coef_)\n",
    "\n",
    "y_predict = lg.predict(x_test)\n",
    "# print(y_predict) #预测的标签\n",
    "print(\"准确率：\", lg.score(x_test, y_test))\n",
    "print(y_test[0:5])\n",
    "print('-'*50)\n",
    "print(lg.predict_proba(x_test)[0:5])  #得出对应分类的概率\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    },
    "ExecuteTime": {
     "end_time": "2025-01-13T07:35:24.120002Z",
     "start_time": "2025-01-13T07:35:24.108291Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[1.11400191 0.25293086 0.78938469 0.60986034 0.0728013  1.10834397\n",
      "  0.7794668  0.64312128 0.67692658]]\n",
      "准确率： 0.9824561403508771\n",
      "444    2\n",
      "24     2\n",
      "195    2\n",
      "49     4\n",
      "375    2\n",
      "Name: Class, dtype: int64\n",
      "--------------------------------------------------\n",
      "[[0.94893919 0.05106081]\n",
      " [0.99494175 0.00505825]\n",
      " [0.98365149 0.01634851]\n",
      " [0.02707911 0.97292089]\n",
      " [0.99732446 0.00267554]]\n"
     ]
    }
   ],
   "execution_count": 52
  },
  {
   "cell_type": "code",
   "source": [
    "# 为什么还要看下召回率，labels和target_names对应\n",
    "# macro avg 平均值  weighted avg 加权平均值\n",
    "print(classification_report(y_test, y_predict, labels=[2, 4], target_names=[\"良性\", \"恶性\"]))\n",
    "#AUC计算要求是二分类，不需要是0和1\n",
    "print(\"AUC指标：\", roc_auc_score(y_test, y_predict))"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-01-13T07:39:09.422215Z",
     "start_time": "2025-01-13T07:39:09.406855Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "              precision    recall  f1-score   support\n",
      "\n",
      "          良性       0.97      1.00      0.99       111\n",
      "          恶性       1.00      0.95      0.97        60\n",
      "\n",
      "    accuracy                           0.98       171\n",
      "   macro avg       0.99      0.97      0.98       171\n",
      "weighted avg       0.98      0.98      0.98       171\n",
      "\n",
      "AUC指标： 0.975\n"
     ]
    }
   ],
   "execution_count": 53
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(512, 9)\n",
      "(171, 9)\n"
     ]
    }
   ],
   "source": [
    "print(x_train.shape)\n",
    "print(x_test.shape)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2.3025850929940455\n"
     ]
    }
   ],
   "source": [
    "print(-np.log(0.1))"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "outputs": [
    {
     "data": {
      "text/plain": "0.10536051565782628"
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "-np.log(0.9)\n",
    "\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "outputs": [
    {
     "data": {
      "text/plain": "3.55"
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x=-3/10\n",
    "y=5*x**2+3*x+4\n",
    "y"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
